/**
 * Copyright © 2020 易久批信息技术有限公司. All rights reserved.
 */
package com.dysm.composite;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author xiay
 * @since 2020/12/12 8:28 下午
 */
public class FolderFile implements FileInterface {

    private String name;

    private List<FileInterface> childFileList;

    public FolderFile(String name) {
        this.name = name;
        childFileList = new ArrayList<>();
    }

    public void add(FileInterface file) {
        childFileList.add(file);
    }

    /**
     * 扫描文件
     */
    @Override
    public void scanFile() {
        System.out.println("文件夹：" + name + "已被扫描~");
        for (FileInterface file : childFileList) {
            file.scanFile();
        }
    }
}
